﻿using NB.MGJ.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;

namespace NB.MGJ.API
{
    public class ApiVisitFilter : ActionFilterAttribute
    {
        private string _PageName { get; set; }
        public ApiVisitFilter(string _pagename)
        {
            this._PageName = _pagename;
        }
        public override Task OnActionExecutingAsync(System.Web.Http.Controllers.HttpActionContext actionContext, System.Threading.CancellationToken cancellationToken)
        {
            if (!string.IsNullOrWhiteSpace(_PageName))
            {
                Sys_PV_UV_Service.PV_UV_Add(GetClientIp.GetClientIpAddress(actionContext), _PageName);
            }
            return base.OnActionExecutingAsync(actionContext, cancellationToken);
        }
    }
}
